<template>
  <section class="category-section">
    <div class="category-tabs">
      <div class="tab-container">
        <a v-for="(tab, index) in tabs" :key="index" :class="['tab-item', { active: activeTab === tab.category_id }]"
          @click="switchTab(tab)">
          {{ tab.name }}
        </a>
      </div>
    </div>

    <div class="product-container">
      <!-- 自定义轮播图 -->
      <div class="carousel">
        <!-- 轮播控制按钮 -->
        <button class="carousel-arrow prev" @click="prevSlide" aria-label="Previous slide" :disabled="isFirstPage"
          :class="{ 'disabled': isFirstPage }">
          <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path d="M15 19L8 12L15 5" stroke="currentColor" stroke-width="2" stroke-linecap="round"
              stroke-linejoin="round" />
          </svg>
        </button>

        <div class="carousel-container">
          <div class="carousel-track" :style="carouselTrackStyle">
            <!-- 正常的轮播内容，移除克隆幻灯片，使用常规分页 -->
            <div class="carousel-slide" v-for="(group, groupIndex) in productGroups" :key="groupIndex">
              <div class="product-card" v-for="product in group" :key="product.id">
                <div class="product-image-container">
                  <span v-if="product.badge" class="badge">{{ product.badge }}</span>
                  <div class="product-image-wrapper">
                    <a :href="`/product/${product.url}.html`">
                      <img :src="product.image" :alt="product.title" class="product-image main-image">
                      <img :src="product.hoverImage" :alt="`${product.title} Hover`" class="product-image hover-image">
                    </a>
                    <button class="wishlist-btn" @click.prevent="toggleWishlist(product)">
                      <svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                        <path
                          d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"
                          :stroke="product.is_favorited === 1 ? 'none' : 'currentColor'"
                          :fill="product.is_favorited === 1 ? '#000' : 'none'" stroke-width="2" />
                      </svg>
                    </button>
                  </div>
                  <div class="product-actions">
                    <button class="add-to-cart-btn" @click.prevent.stop="addToCart(product)">ADD TO CART</button>
                  </div>
                </div>
                <div class="product-info">
                  <h3 class="product-title">{{ product.title }}</h3>
                  <p class="product-price">{{ useCurrency.currentCurrency.unit }} {{
                    globalProperties?.$ConvertPrice(product.price) }}<span class="zk-price">{{
                      useCurrency.currentCurrency.unit }} {{
                        globalProperties?.$ConvertPrice(product.origin_price) }}</span></p>
                </div>
              </div>
            </div>
          </div>
        </div>

        <button class="carousel-arrow next" @click="nextSlide" aria-label="Next slide" :disabled="isLastPage"
          :class="{ 'disabled': isLastPage }">
          <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path d="M9 5L16 12L9 19" stroke="currentColor" stroke-width="2" stroke-linecap="round"
              stroke-linejoin="round" />
          </svg>
        </button>
      </div>

      <!-- 轮播指示器 -->
      <!-- <div class="carousel-indicators">
        <button 
          v-for="(_, index) in productGroups" 
          :key="index"
          :class="['indicator', { active: currentSlide === index }]" 
          @click="goToSlide(index)"
          :aria-label="`Go to slide ${index + 1}`"
        ></button>
      </div> -->

      <!-- <div class="shop-now"> -->
      <!-- 跳转分类页面 -->
      <!-- <a href="/products">SHOP NOW</a> -->
      <!-- </div> -->
    </div>
  </section>

  <!-- Add modal for product detail -->
  <a-modal v-model:open="open" width="1260px" title="Product Detail" :footer="null">
    <ProductDetail.default v-if="open && goodId" :goodId="goodId" @buy="handleBuy" />
  </a-modal>
</template>

<script lang="ts" setup>
import { ref, reactive, computed, onMounted, onBeforeUnmount, watch, getCurrentInstance } from 'vue';
import { useRouter } from 'vue-router';
import { useCurrencyStore } from '@/store'
import { message } from 'ant-design-vue';
import { addFavorite, deleteFavorite } from '@/api/goods';
import * as ProductDetail from '@/components/ProductDetail.vue';
import { useCartStore } from '@/store/cart';
import { Session } from '@/utils/storage';
import { getToken } from '@/utils/auth';
// 定义产品接口
interface Product {
  id: number;
  title: string;
  price: number;
  image: string;
  hoverImage: string;
  badge?: string;
  is_favorited: number;
  inventory: number;
}

// 定义标签页接口, 修改与实际数据结构匹配
interface Tab {
  name: string;
  url: string;
  category_id: string;
  goods: any[];
}

const props = defineProps<{
  options: Product;
}>();

const router = useRouter();
// 获取组件实例
const instance = getCurrentInstance();
// 获取全局属性和转换价格方法
const globalProperties = instance ? (instance as any).proxy : null;
const useCurrency = useCurrencyStore()
const cartStore = useCartStore();
// 修改goodId类型为string，允许null
const goodId = ref<string | null>(null);
const open = ref<boolean>(false);
// 定义标签页数据
const tabs = reactive<Tab[]>([
  // {
  //   name: 'BEST SELLERS',
  //   url: '/best-sellers',
  //   isActive: true
  // },
  // {
  //   name: 'LINEN',
  //   url: '/linen',
  //   isActive: false
  // },
  // {
  //   name: 'XIANG YUN SILK',
  //   url: '/xiang-yun-silk',
  //   isActive: false
  // }
]);

// 定义产品数据
const products = ref<Product[]>([
  // {
  //   id: 1,
  //   title: '100% Linen Vest And Pants Two-Piece Set',
  //   price: 159,
  //   image: 'https://cdn.shopify.com/s/files/1/0617/0099/7296/files/a9cd27cd1bb38dfdd3b08c3c3f4ea164.jpg?v=1744851115',
  //   hoverImage: 'https://cdn.shopify.com/s/files/1/0617/0099/7296/files/56fc64f0dc9697b81dd89d04afd03e9e.jpg?v=1745736279',
  //   badge: 'Best Seller',
  //   isWishlist: false,
  //   inventory: 10
  // },
]);

let activeTab = ref('');
const switchTab = (tab: Tab) => {
  activeTab.value = tab.category_id;
  products.value = tab.goods.map((item: any) => {
    return {
      ...item,
      title: item.name,
      price: item.min_price,
      origin_price: item.max_origin_price,
      image: item.images[0] || '',
      hoverImage: item.images[1] || item.images[0] || '',
      badge: item.discount_enabled === 1 ? `-${item.discount}% OFF` : '',
      is_favorited: 0,
    }
  });

  // 重置轮播位置到第一页
  currentSlide.value = 0;
  // 关闭过渡动画，确保无缝切换
  isTransitioning.value = false;
}

const handleBuy = (product: any) => {
  console.log('Buy product:', product);
  // message.success('The product has been successfully added to the cart');
  open.value = false;
};

watch(() => props.options, (newVal) => {
  console.log('商品数据已更新:', props.options);
  if (!newVal) return;

  // 处理props.options，确保它是数组
  const optionsArray = Array.isArray(newVal) ? newVal : [newVal];
  if (optionsArray.length === 0) return;

  optionsArray.forEach((item: any) => {
    tabs.push({
      ...item,
      name: item.title,
    });
  });

  if (tabs.length > 0 && tabs[0].category_id && tabs[0].goods) {
    activeTab.value = tabs[0].category_id;
    products.value = tabs[0].goods.map((item: any) => {
      return {
        ...item,
        title: item.name,
        price: item.min_price,
        origin_price: item.max_origin_price,
        image: item.images[0] || '',
        hoverImage: item.images[1] || item.images[0] || '',
        badge: item.discount_enabled === 1 ? `-${item.discount}% OFF` : '',
        is_favorited: 0,
      }
    });
  }
}, { immediate: true });


// 轮播相关状态
const currentSlide = ref(0); // 从0开始，直接指向当前分组索引
const isTransitioning = ref(false);
const itemsPerGroup = ref(4); // 每组显示4个产品
let autoplayInterval = ref<number | null>(null);
// 明确指定productGroups的类型，使用any[][]避免类型错误
let productGroups = ref<any[][]>([]);
// 添加计算属性来判断是否为第一页或最后一页
const isFirstPage = computed(() => currentSlide.value === 0);
// const isLastPage = computed(() => currentSlide.value === productGroups.value.length - 1);
const isLastPage = ref(false);
watch(() => products.value, (newVal) => {
  if (newVal.length > 0) {
    initProductGroups()
  }
}, { immediate: true });

watch(() => productGroups.value, (newVal) => {
  console.log('productGroups', newVal)
  isLastPage.value = currentSlide.value === newVal.length - 1;
}, { deep: true });

// 轮播轨道样式
const carouselTrackStyle = computed(() => {
  return {
    transform: `translateX(-${currentSlide.value * 100}%)`,
    transition: isTransitioning.value ? 'transform 0.5s ease' : 'none'
  };
});

const initProductGroups = () => {
  const groups = [];
  const productsArray = [...products.value];
  console.log('productsArray', productsArray)
  if (productsArray.length === 0) return;

  // 获取收藏列表并且设置是否收藏isWishlist
  let collectList = Session.get('collectList');

  if (collectList) {
    productsArray.forEach(item => {
      // 如果collectList是数组形式
      collectList.forEach((collect: any) => {
        if (collect.goods_id === item.id) {
          item.is_favorited = 1;
        }
      });
    });
  }

  for (let i = 0; i < productsArray.length; i += itemsPerGroup.value) {
    groups.push(productsArray.slice(i, i + itemsPerGroup.value));
  }

  // 赋值给productGroups
  productGroups.value = groups;
}


// 轮播控制函数
const nextSlide = () => {
  if (isTransitioning.value || isLastPage.value) return;

  isTransitioning.value = true;
  currentSlide.value++;

  resetAutoplay();

  setTimeout(() => {
    isTransitioning.value = false;
  }, 500);
};

const prevSlide = () => {
  if (isTransitioning.value || isFirstPage.value) return;

  isTransitioning.value = true;
  currentSlide.value--;

  resetAutoplay();

  setTimeout(() => {
    isTransitioning.value = false;
  }, 500);
};

const goToSlide = (index: number) => {
  if (isTransitioning.value || currentSlide.value === index) return;

  isTransitioning.value = true;
  currentSlide.value = index;

  resetAutoplay();

  setTimeout(() => {
    isTransitioning.value = false;
  }, 500);
};

// 自动播放控制
const startAutoplay = () => {
  stopAutoplay();
  nextSlide();
  // autoplayInterval.value = window.setInterval(() => {
  //   nextSlide();
  // }, 10000); // 5秒切换一次
};

const stopAutoplay = () => {
  if (autoplayInterval.value) {
    clearInterval(autoplayInterval.value);
    autoplayInterval.value = null;
  }
};

const resetAutoplay = () => {
  if (autoplayInterval.value) {
    startAutoplay();
  }
};
const isLogin = ref(!!getToken());;
// 添加到收藏
const toggleWishlist = async (product: Product): Promise<void> => {
  if(!isLogin.value){
    message.error('Please log in first.');
    setTimeout(() => {
      router.push('/login');
    }, 1500);
    return;
  }
  try {
    // 根据当前状态决定是添加还是删除收藏
    const res = product.is_favorited === 1
      ? await deleteFavorite(String(product.id))
      : await addFavorite(String(product.id));

    if (res.code === 200) {
      // 更新UI状态
      if (product.is_favorited === 1) {
        product.is_favorited = 0;
      } else {
        product.is_favorited = 1;
      }

      // 显示成功消息
      const action = product.is_favorited === 1 ? 'added to' : 'removed from';
      message.success(`Item ${action} wishlist successfully`);
      
      // 更新本地存储中的收藏列表
      let collectList = Session.get('collectList');
      
      if (!collectList) {
        collectList = [];
      }
      
      if (product.is_favorited === 1) {
        // 添加到收藏列表
        if (Array.isArray(collectList)) {
          // 确保不重复添加
          if (!collectList.some((item: any) => item.goods_id === product.id)) {
            collectList.push({ goods_id: product.id });
          }
        } else if (collectList.data && Array.isArray(collectList.data)) {
          // 如果collectList有data属性且是数组
          if (!collectList.data.some((item: any) => item.goods_id === product.id)) {
            collectList.data.push({ goods_id: product.id });
          }
        } else {
          // 如果collectList既不是数组也没有data属性，则初始化为数组
          collectList = [{ goods_id: product.id }];
        }
      } else {
        // 从收藏列表中移除
        if (Array.isArray(collectList)) {
          collectList = collectList.filter((item: any) => item.goods_id !== product.id);
        } else if (collectList.data && Array.isArray(collectList.data)) {
          collectList.data = collectList.data.filter((item: any) => item.goods_id !== product.id);
        }
      }
      
      // 保存更新后的收藏列表到sessionStorage
      Session.set('collectList', collectList);
      
      // 更新所有产品组中的相同产品
      productGroups.value.forEach(groupItems => {
        groupItems.forEach((item: any) => {
          if (item.id === product.id) {
            item.is_favorited = product.is_favorited;
          }
        });
      });
      
      // 强制组件重新渲染
      const currentIndex = currentSlide.value;
      productGroups.value = [...productGroups.value];
    }
  } catch (error) {
    console.error('Failed to update favorite status:', error);
    message.error('Operation failed, please try again later');
  }
};

// 添加到购物车
const addToCart = (product: Product): void => {
  if(!isLogin.value){
    message.error('Please log in first.');
    setTimeout(() => {
      router.push('/login');
    }, 1500);
    return;
  }
  // 这里可以添加添加到购物车的API调用
  open.value = true;
  goodId.value = String(product.id); // 将数字ID转换为字符串
  console.log('Add to cart product:', product.id);
};

// 窗口大小调整处理
const updateItemsPerGroup = () => {
  const width = window.innerWidth;
  if (width <= 480) {
    itemsPerGroup.value = 1;
  } else if (width <= 768) {
    itemsPerGroup.value = 2;
  } else if (width <= 1024) {
    itemsPerGroup.value = 3;
  } else {
    itemsPerGroup.value = 4;
  }
};

// 生命周期钩子
onMounted(() => {
  updateItemsPerGroup();
  window.addEventListener('resize', updateItemsPerGroup);
  startAutoplay();

  // 初始化时确保不显示过渡效果
  isTransitioning.value = false;

  // 加载收藏状态
  updateProductsWishlistStatus();
});

// 更新产品的收藏状态
const updateProductsWishlistStatus = (): void => {
  try {
    const collectList = Session.get('collectList');
    if (collectList) {
      // 更新产品的收藏状态
      products.value.forEach(product => {
        if (Array.isArray(collectList)) {
          // 如果collectList是数组
          (product as any).isWishlist = collectList.some((item: any) =>
            item.goods_id === product.id
          );
          // 同时更新is_favorited属性以保持一致性
          product.is_favorited = (product as any).isWishlist ? 1 : 0;
        } else if (collectList.data && Array.isArray(collectList.data)) {
          // 如果collectList有data属性且是数组
          (product as any).isWishlist = collectList.data.some((item: any) =>
            item.goods_id === product.id
          );
          // 同时更新is_favorited属性以保持一致性
          product.is_favorited = (product as any).isWishlist ? 1 : 0;
        }
      });
    }
  } catch (error) {
    console.error('Error updating wishlist status:', error);
  }
};

// 监听产品数据变化，更新收藏状态
watch(() => products.value, () => {
  updateProductsWishlistStatus();
}, { deep: true });

onBeforeUnmount(() => {
  window.removeEventListener('resize', updateItemsPerGroup);
  stopAutoplay();
});

// 暴露组件内部方法和数据
defineExpose({
  products,
  tabs,
  currentSlide,
  nextSlide,
  prevSlide,
  goToSlide
});
</script>

<style scoped lang="scss">
// 分类区域样式
.category-section {
  margin-bottom: 90px;
  margin-top: 110px;
  width: 100%;
  background-color: #fff;
}

.category-tabs {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
  width: 100%;
  overflow: hidden;
  /* 防止外部溢出 */
}

.tab-container {
  display: flex;
  border-bottom: 1px solid #e5e5e5;
  padding-bottom: 10px;
  overflow-x: auto;
  /* 启用水平滚动 */
  scrollbar-width: thin;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE and Edge */
  white-space: nowrap;
  /* 防止标签换行 */
  -webkit-overflow-scrolling: touch;
  /* 平滑滚动效果 */
  padding-bottom: 15px;
  /* 增加底部空间放置滚动条 */
  max-width: 100%;
}

/* 隐藏Chrome滚动条但保留功能 */
.tab-container::-webkit-scrollbar {
  height: 3px;
  /* 控制滚动条高度 */
}

.tab-container::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.tab-container::-webkit-scrollbar-track {
  background-color: rgba(0, 0, 0, 0.05);
}

.tab-item {
  font-size: 16px;
  font-weight: 500;
  color: #6c6c6c;
  padding: 0 20px;
  position: relative;
  text-decoration: none;
  letter-spacing: 1px;
  cursor: pointer;
  flex: 0 0 auto;
  /* 防止项目被压缩 */
  white-space: nowrap;
  /* 防止文字换行 */
}

.tab-item.active {
  color: #000;
  font-weight: 600;
}

.tab-item.active:after {
  content: '';
  position: absolute;
  bottom: -11px;
  left: 20px;
  right: 20px;
  height: 2px;
  background-color: #000;
}

.product-container {
  margin: 0 auto;
  padding: 0 15px;
  position: relative;
}

// 轮播图样式
.carousel {
  position: relative;
  width: 100%;
  overflow: hidden;
  // margin-bottom: 30px;
  display: flex;
  align-items: center;
}

.carousel-container {
  width: 100%;
  overflow: hidden;
}

.carousel-track {
  display: flex;
  transition: transform 0.5s ease;
  will-change: transform;
}

.carousel-slide {
  flex: 0 0 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 25px;
}

.carousel-arrow {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.8);
  border: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  top: calc((133% / 2) - 140px);
  /* 图片高度的一半，基于padding-bottom: 133% */
  transform: translateY(-50%);

  &:hover {
    background-color: rgba(249, 241, 238, 0.9);
    transform: translateY(-50%) scale(1.05);
  }

  &.prev {
    left: 15px;
  }

  &.next {
    right: 15px;
  }

  svg {
    width: 20px;
    height: 20px;
    color: #333;
  }
}

// 指示器样式
.carousel-indicators {
  display: flex;
  justify-content: center;
  // margin-top: 20px;
  gap: 8px;
}

.indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #ccc;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s ease;

  &.active {
    background-color: #000;
    transform: scale(1.2);
  }
}

.product-card {
  position: relative;
  overflow: hidden;
  background-color: #fff;
}

.product-card:hover {
  transform: none;
  box-shadow: none;
}

.product-image-container {
  position: relative;
  width: 100%;
  padding-bottom: 133%;
  /* 3:4 aspect ratio */
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-image-container:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.05);
}

.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background-color: rgb(215, 184, 169);
  color: #fff;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 2px;
  z-index: 2;
}

.product-image-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.product-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.5s ease;
}

.main-image {
  opacity: 1;
}

.hover-image {
  opacity: 0;
}

.product-image-container:hover .main-image {
  opacity: 0;
}

.product-image-container:hover .hover-image {
  opacity: 1;
}

.product-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transform: translateY(0);
  transition: opacity 0.3s ease;
  z-index: 3;
  width: 100%;
}

.product-image-container:hover .product-actions {
  opacity: 1;
}

.add-to-cart-btn {
  background-color: rgba(255, 255, 255, 0.9);
  color: #000;
  border: 1px solid #000;
  padding: 12px 0;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 0;
  letter-spacing: 1px;
  width: 100%;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.add-to-cart-btn:hover {
  background-color: #000;
  color: #fff;
}

.wishlist-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background-color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transition: background-color 0.3s ease;
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.product-image-container:hover .wishlist-btn {
  opacity: 1;
}

.wishlist-btn:hover {
  background-color: #f9f1ee;
}

.product-info {
  padding-top: 15px;
}

.product-title {
  font-size: 14px;
  color: #000;
  margin-bottom: 8px;
  font-weight: 400;
  line-height: 1.4;
}

.product-price {
  font-size: 14px;
  color: #000;
  font-weight: 500;

  .zk-price {
    text-decoration: line-through;
    margin-left: 6px;
    color: #999;
    font-weight: normal;
    font-size: 90%;
  }
}

.shop-now {
  text-align: center;
  width: 160px;
  margin: 20px auto 0;
  padding: 10px 20px;
  border: 1px solid #999;
  font-size: 16px;
  font-weight: 700;
}

/* 移动端适配 */
@media (max-width: 1024px) {
  .carousel-slide {
    grid-template-columns: repeat(3, 1fr);
  }

  .carousel-arrow {
    width: 36px;
    height: 36px;

    &:hover {
      transform: translateY(-50%) scale(1.05);
    }

    svg {
      width: 18px;
      height: 18px;
    }
  }
}

@media (max-width: 768px) {
  .carousel-slide {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }

  .tab-item {
    font-size: 14px;
    padding: 0 15px;
  }

  .product-actions {
    opacity: 1;
  }

  .add-to-cart-btn {
    padding: 10px 0;
    font-size: 11px;
  }

  .wishlist-btn {
    opacity: 1;
  }

  .carousel-arrow {
    width: 32px;
    height: 32px;

    &:hover {
      transform: translateY(-50%) scale(1.05);
    }

    svg {
      width: 16px;
      height: 16px;
    }
  }
}

@media (max-width: 480px) {
  .carousel-slide {
    grid-template-columns: 1fr;
  }

  .tab-container {
    width: 100%;
    justify-content: space-between;
  }

  .tab-item {
    padding: 0 10px;
    font-size: 12px;
  }

  .tab-item.active:after {
    left: 10px;
    right: 10px;
  }

  .product-title {
    font-size: 13px;
  }

  .product-price {
    font-size: 13px;
  }

  .badge {
    font-size: 10px;
    padding: 2px 8px;
  }

  .carousel-arrow {
    width: 28px;
    height: 28px;

    &:hover {
      transform: translateY(-50%) scale(1.05);
    }

    svg {
      width: 14px;
      height: 14px;
    }
  }

  .carousel-indicators {
    margin-top: 15px;
  }

  .indicator {
    width: 6px;
    height: 6px;
  }
}

// 添加禁用状态样式
.carousel-arrow.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
</style>